package net.heri.xmppchat.activities;

import com.google.inject.Inject;

import net.heri.xmppchat.persistence.IXmppChatDBHelper;
import android.annotation.SuppressLint;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import roboguice.RoboGuice;
import roboguice.activity.RoboPreferenceActivity;

@SuppressLint("NewApi")
public class ChatSettingsActivity extends RoboPreferenceActivity {

	private ChatSettingsFragment mChatSettingsFragment;	
	
	//Testing injection
	@Inject
	private IXmppChatDBHelper mDbHelper;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {	
		super.onCreate(savedInstanceState);
		
		System.out.println(mDbHelper);
		
		mChatSettingsFragment = new ChatSettingsFragment();
		Fragment fragment = mChatSettingsFragment;
		
		RoboGuice.injectMembers(ChatSettingsActivity.this, mChatSettingsFragment);
		
		FragmentManager fragmentManager = getFragmentManager();
		FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
		fragmentTransaction.replace(android.R.id.content, fragment);
		fragmentTransaction.commit();
	}
}
